<?php

class CommentModel extends Model
{

    public function gettablePrefix() {
        return $this->tablePrefix;
    }
	
	private function translateText($txt)
	{
		$url='<a href="'.SITE_URL.'/index.php?s=/space/';
		//$url='<a href="http://localhost/thinksns1.6/index.php?s=/space/';
		return preg_replace("/@(.+?)\((\d+)\)([\s|:]|$)/is",$url.'${2}">@${1}${3}</a>' ,$txt);
	}
	
    public function getComment($map,$order,$page,$method ){
        if( $method == "findAll" ){
            $comment = $this->where( $map )->order( $order )->$method();
        }else{
            $comment = $this->where( $map )->order( $order )->$method($page);
        }
		
		
		/*foreach ($comment as $v)
		{
			$v['title_data']=translateText($v['title_data']);
			$v['body_data']=translateText($v['body_data']);
		}*/
        return $comment;
    }
}
?>
